package com.cskaoyan.controller;

import com.cskaoyan.bean.bo.WXCollectAODBO;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.WXCollectListVO;
import com.cskaoyan.service.WXCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RequestMapping("/wx/collect")
@RestController
public class WXCollectController {

    @Autowired
    WXCollectService wxCollectService;

    @RequestMapping("/list")
    public BaseRespVo list(Integer type, Integer page, Integer limit) {
        WXCollectListVO wxCollectListVO = wxCollectService.list(type, page, limit);
        return BaseRespVo.success(wxCollectListVO);
    }

    @PostMapping("/addordelete")
    public BaseRespVo addordelete(@RequestBody WXCollectAODBO wxCollectAODBO) {
        HashMap<String, String> map = new HashMap<>( );
        String addordelete = wxCollectService.addordelete(wxCollectAODBO);
        map.put("type", addordelete);
        return BaseRespVo.success(map);
    }

}
